package com.amigo.online.provider.msync.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.amigo.online.provider.msync.mapper.UserSyncMapper;
import com.amigo.online.provider.msync.service.VideoSyncService;
import com.amigo.online.provider.sync.handle.data.mongo.service.UserMongoService;
import com.amigo.online.provider.sync.handle.data.solr.service.UserSolrService;

@Service
public class VideoSyncServiceImpl implements VideoSyncService {

    @Autowired
    UserMongoService userMongoService;

    @Autowired
    UserSolrService userSolrService;

    @Autowired
    @Qualifier("comparsionQueueThreadPool")
    ExecutorService executorService;

    @Autowired
    UserSyncMapper userSyncMapper;

    @Override
    public boolean comparisonVideoFromMysqlToSolr(List<Long> ids) {
        List<Object> mysqlList = new ArrayList<>();
        List<Object> solrList = new ArrayList<>();
        CompletableFuture<String> future2 = CompletableFuture.supplyAsync(() -> {

            List<Object> mysqlResult = userSyncMapper.listFindUserByIds(ids);

            return "";
        }, executorService);

        // 小明买烟任务，这里的future1代表的是小明未来买东西会发生的事，返回值是小明买东西的结果
        CompletableFuture<String> future1 = CompletableFuture.supplyAsync(() -> {
            //userSolrService.listFindVideoByIds(ids);
            return "这是我托人带来的口信，我已经不在了。";

        }, executorService);

        return false;
    }

    @Override
    public boolean comparisonVideoFromMysqlToMongo(List<Long> convertStringIdsToList) {
        //mysqlList = userMongoService.ListUserByIds(ids);
        return false;
    }

}
